Connecting to official servers is a lot more difficult than custom/private servers, as they require an EOS (Epic Online Services) token and user id for authentication with the Among Us servers.
You can, however, generate these using SkeldJS for automated users/clients.
Now, EOS authentication with Among Us official servers is a little bit cumbersome, and you'll likely find yourself having to cache authentication keys.
Put simply though, you can use SkeldJS' @skeldjs/eos
package to generate these keys for you:
import { AuthMethod, EosHttpApi } from "../index";
const clientId = "xyza7891qtrmoYLr86we6DlfCA1RRsp8";
const clientSecret = "nGThQanzvthA2HPaARXe/xutzsKyx5WJveNkBx44ti4";
const deploymentId = "3ce14d8292084c80a8364a8b5f0dfbf4";
const randomDeviceModel = EosHttpApi.generateRandomDeviceModel();
const { access_token } = await EosHttpApi.authRequestGetDeviceIdAccessToken(clientId, clientSecret, randomDeviceModel);
const account = await EosHttpApi.authRequestEosAccessToken({
grantType: "external_auth",
externalAuthType: "deviceid_access_token",
clientId: clientId,
clientSecret: clientSecret,
deploymentId: deploymentId,
nonce: "aaaaaaaaab",
displayName: "your_username",
externalAuthToken: access_token,
});
Note that the
deploymentId
is subject to change through Among Us versions, check back here for the latest value.
Constant | Value |
---|---|
clientId |
xyza7891qtrmoYLr86we6DlfCA1RRsp8 |
clientSecret |
nGThQanzvthA2HPaARXe/xutzsKyx5WJveNkBx44ti4 |
deploymentId |
3ce14d8292084c80a8364a8b5f0dfbf4 |
Now the values used in account
are quick to expire, and last about an hour before you have to run that function again.
However, the access_token
generated by EosHttpApi.authRequestGetDeviceIdAccessToken
lasts a lot longer, and you'll end up being rate limited if you call that too often.
Therefore, you can use the SkeldJS tool npx skeldjs-generate-eos-token
in your console to quickly generate one to use in your project:
With an account
object, you can now connect to an among us server:
const client = new skeldjs.SkeldjsClient("2022.9.2.0s", "weakeyes", {
authMethod: AuthMethod.SecureTransport,
idToken: account.id_token,
eosProductUserId: account.product_user_id
});
console.log("Connecting to server..");
await client.connect("https://matchmaker.among.us", 443);
console.log("Creating game..");
const code = await client.createGame();
client.myPlayer!.control!.setName("weakeyes");
client.myPlayer!.control!.setColor(skeldjs.Color.Red);
console.log("Created game @ %s", GameCode.convertIntToString(code));
Each region on the official servers has its own dedicated endpoint/url to connect to:
Region name | Endpoint |
---|---|
North America | https://matchmaker.among.us |
Europe | https://matchmaker-eu.among.us |
Asia | https://matchmaker-as.among.us |
You can also find this information at
%AppData%/LocalLow/Innersloth/Among Us/regionInfo.json
on your local machine
If the server you want to connect to has a http matchmaker, you can use the same code as bove but omitting the idToken
, eosProductUserId
and setting the authMethod
to {@link AuthMethod.None} (unless the server you're connecting to supports DTLS, then use {@link AuthMethod.SecureTransport} like above):
const client = new skeldjs.SkeldjsClient("2022.9.2.0s", "weakeyes", {
authMethod: AuthMethod.None
});
console.log("Connecting to server..");
await client.connect("https://example.com", 443);
console.log("Creating game..");
const code = await client.createGame();
client.myPlayer!.control!.setName("weakeyes");
client.myPlayer!.control!.setColor(skeldjs.Color.Red);
console.log("Created game @ %s", GameCode.convertIntToString(code));
If your server doesn't support the new HTTP matchmaking system, you can simply set useHttpMatchmaker
to false
in the client constructor:
const client = new skeldjs.SkeldjsClient("2022.9.2.0s", "weakeyes", {
authMethod: AuthMethod.None,
useHttpMatchmaker: false
});
Generated using TypeDoc